= loadstring (X)Return F ()End )))
--> Sin (3) = 0.1411200080598672; 2 ^ 5 = 32
The first match is "$ [math. Sin (3)]", and the corresponding capture is "[math. Sin (3)]". Call string. sub to remove the square brackets at the beginning and end,Therefore, the string to be loaded and executed is "Return math. Sin (3)", and the matching condition of "$ [2 ^ 5]" is similar.We often need to use string. gsub to traverse strings, but we are not interested in the returned results. For example, we colle
Company new platform on-line, the old database has some original user data need to migrate to the new platform, specially developed this script to ensure data integrity, and efficiency #!/bin/bash# #到出旧数据库中需要的表echo "Please prepare 3 files in the scripting language directory, One for Tables.txt, which lists the name of the table that needs to be exported from the old database, the user account password Oldmysqlauth the old database, and the database, and the third is the user account password an
Table
Basically, this section is about document translation. I don't plan to write examples. The reason is explained at the end.
Table means that you can write any style table. How can any style tables be recognized and executed by fitnesse? And how to display the execution results? Let's take a look.
The basic idea of the above tables is to either determine the method name (Decision Table) by the header, or fix the method name (Dynamic Decision Table, query table ); you can also use some iden
#! /Bin/bash
If [$1] # If no parameter existsThenEcho database $1;ElseEcho 'backup database tables to gzip files sh bak_db_table.sh DB [db_host] [db_user] [db_passwd] '; exit;Fi
# Parameter assignment[$1] DB = $1[$2] DBH = $2[$3] dbu = $3[$4] DBP = $4
# Configure database Parameters[$ DBH] DBH = "-h" $ DBH[$ Dbu] dbu = "-U" $ dbu[$ DBP] DBP = "-P" $ DBP
Day = 'date + % Y % m % d'
# Create a directory named after dB if it does not existDb_dir =/opt/db_bak/$ db' _ '$ day[-A $ db_dir] | mkdi
. When performing the addition operation, lua first checks whether A has a retriable and whether the _ add domain exists in the retriable. If yes, it calls the statement. Otherwise, it checks the condition of B (which is the same as that of ), if no addition operation exists, the default addition operation is called, and the table does not define the default addition operation. An error is reported.
-- Define two tablesA = {5, 6}B = {7, 8}-- Use C for retriableC = {}-- Redefinition of addition
In java, it is easy to use regular expressions to split a string. The following uses Lua to implement the spilt function.
Method 1:
Local spilt = function (str, pattern) local ret = {}; local _ pattern = "[^ ".. pattern .. "] +"; for s in string. gfind (str, _ pattern) dotable. insert (ret, s); endreturn ret; end
Method 2:
Local spilt = function (str, pattern) local ret = {} string. gsub (str, "[^ ".. pattern .. "] +", function (item) tabl
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.